package frame.project;

import android.app.Activity;
import android.content.ActivityNotFoundException;
import android.content.Intent;
import android.graphics.Bitmap;
import android.graphics.Matrix;
import android.net.Uri;
import android.os.Bundle;
import android.widget.ImageView;
import android.widget.Toast;

public class ImageProcess extends Activity {
	
	
	//keep track of cropping intent
	final int PIC_CROP = 2;
	//captured picture uri
	private Uri picUri;
	private static final int CROP_FROM_CAMERA = 2;
	ImageView imageView;
	
    
    	
    	 
    	    
    	    /**
    	     * Helper method to carry out crop operation
    	     */
    	  
    	
        
   

   

	/**
	 * Do a rotation on Bitmap
	 * @param bMap
	 * @param rotate
	 * @author Jourdan
	 */
    public Bitmap performRotate(Bitmap bMap, int rotate){
     
        Matrix matrix;

        //Create object of new Matrix.
        matrix = new Matrix();        
        
        //switch statement for rotate image
        switch(rotate) {
        case 0: 
        	matrix.postRotate(0);
        	break;
        case 1: 
        	matrix.postRotate(90);
    		break;
        case 2: 
        	matrix.postRotate(180);
        	break;
        case 3: 
        	matrix.postRotate(270);
        	break;
        default: 
        	matrix.postRotate(0);
        	break;
        }

        //Create bitmap with new values.
        Bitmap bMapRotate = Bitmap.createBitmap(bMap, 0, 0, bMap.getWidth(), bMap.getHeight(), matrix, true);
        
        return bMapRotate;
    }
}

